import VueRouter from 'vue-router'

//引入组件
import Index from '../pages'
import Home from '../pages/home/home'
import Login from '../pages/login/login'
import Register from '../pages/register/register'
import Center from '../pages/center/center'
import Storeup from '../pages/storeup/list'
import News from '../pages/news/news-list'
import NewsDetail from '../pages/news/news-detail'
import yonghuList from '../pages/yonghu/list'
import yonghuDetail from '../pages/yonghu/detail'
import yonghuAdd from '../pages/yonghu/add'
import yaopinxinxiList from '../pages/yaopinxinxi/list'
import yaopinxinxiDetail from '../pages/yaopinxinxi/detail'
import yaopinxinxiAdd from '../pages/yaopinxinxi/add'
import yishengList from '../pages/yisheng/list'
import yishengDetail from '../pages/yisheng/detail'
import yishengAdd from '../pages/yisheng/add'
import xianshangguahaoList from '../pages/xianshangguahao/list'
import xianshangguahaoDetail from '../pages/xianshangguahao/detail'
import xianshangguahaoAdd from '../pages/xianshangguahao/add'
import jianchabaogaoList from '../pages/jianchabaogao/list'
import jianchabaogaoDetail from '../pages/jianchabaogao/detail'
import jianchabaogaoAdd from '../pages/jianchabaogao/add'
import yaofangxinxiList from '../pages/yaofangxinxi/list'
import yaofangxinxiDetail from '../pages/yaofangxinxi/detail'
import yaofangxinxiAdd from '../pages/yaofangxinxi/add'
import systemintroList from '../pages/systemintro/list'
import systemintroDetail from '../pages/systemintro/detail'
import systemintroAdd from '../pages/systemintro/add'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

//配置路由
export default new VueRouter({
	routes:[
		{
      path: '/',
      redirect: '/index/home'
    },
		{
			path: '/index',
			component: Index,
			children:[
				{
					path: 'home',
					component: Home
				},
				{
					path: 'center',
					component: Center,
				},
				{
					path: 'storeup',
					component: Storeup
				},
				{
					path: 'news',
					component: News
				},
				{
					path: 'newsDetail',
					component: NewsDetail
				},
				{
					path: 'yonghu',
					component: yonghuList
				},
				{
					path: 'yonghuDetail',
					component: yonghuDetail
				},
				{
					path: 'yonghuAdd',
					component: yonghuAdd
				},
				{
					path: 'yaopinxinxi',
					component: yaopinxinxiList
				},
				{
					path: 'yaopinxinxiDetail',
					component: yaopinxinxiDetail
				},
				{
					path: 'yaopinxinxiAdd',
					component: yaopinxinxiAdd
				},
				{
					path: 'yisheng',
					component: yishengList
				},
				{
					path: 'yishengDetail',
					component: yishengDetail
				},
				{
					path: 'yishengAdd',
					component: yishengAdd
				},
				{
					path: 'xianshangguahao',
					component: xianshangguahaoList
				},
				{
					path: 'xianshangguahaoDetail',
					component: xianshangguahaoDetail
				},
				{
					path: 'xianshangguahaoAdd',
					component: xianshangguahaoAdd
				},
				{
					path: 'jianchabaogao',
					component: jianchabaogaoList
				},
				{
					path: 'jianchabaogaoDetail',
					component: jianchabaogaoDetail
				},
				{
					path: 'jianchabaogaoAdd',
					component: jianchabaogaoAdd
				},
				{
					path: 'yaofangxinxi',
					component: yaofangxinxiList
				},
				{
					path: 'yaofangxinxiDetail',
					component: yaofangxinxiDetail
				},
				{
					path: 'yaofangxinxiAdd',
					component: yaofangxinxiAdd
				},
				{
					path: 'systemintro',
					component: systemintroList
				},
				{
					path: 'systemintroDetail',
					component: systemintroDetail
				},
				{
					path: 'systemintroAdd',
					component: systemintroAdd
				},
			]
		},
		{
			path: '/login',
			component: Login
		},
		{
			path: '/register',
			component: Register
		},
	]
})
